import Cookies from 'js-cookie'

const TokenKey = 'Admin-Token'
const RoleKey = 'role-list'

export function getToken() {
  return Cookies.get(TokenKey)
}

export function setToken(token) {
  return Cookies.set(TokenKey, token)
}

export function removeToken() {
  return Cookies.remove(TokenKey)
}

export function getRoles() {
  return JSON.parse(Cookies.get(RoleKey) || '[]')
}

export function setRoles(roles) {
  return Cookies.set(RoleKey, JSON.stringify(roles))
}

export function removeRoles() {
  return Cookies.remove(RoleKey)
}
